<html lang="en">

<head>
  <style>
    html {
      font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto
    }

    html,
    body {
      width: 100vw;
      height: 100vh;
      display: flex;
      background-color: rgb(54, 50, 119);
      align-items: center;
      justify-content: center;
      color: #fafafa;
    }

    .loading {
      text-align: center;
    }
  </style>

</head>

<body>
  <div class="loading">
    <div>
      <img
        src="" />
      <img
        src="" />
    </div>
    <h3>Loading &laquo; datepicker - range-popup &raquo; demo</h3>
  </div>
  <form id="mainForm" method="post" action="https://stackblitz.com/run?file=app/datepicker-range-popup.ts" target="_self">
    <input type="hidden" name="project[template]" value="angular-cli">
    <input type="hidden" name="project[title]" value="ng-bootstrap - Datepicker - Range-popup">
    <input type="hidden" name="project[description]"
      value="Example usage of the datepicker widget from https://ng-bootstrap.github.io">
    <input type="hidden" name="project[dependencies]" value="{&#34;@angular/animations&#34;:&#34;~13.0.1&#34;,&#34;@angular/core&#34;:&#34;~13.0.1&#34;,&#34;@angular/common&#34;:&#34;~13.0.1&#34;,&#34;@angular/compiler&#34;:&#34;~13.0.1&#34;,&#34;@angular/compiler-cli&#34;:&#34;~13.0.1&#34;,&#34;@angular/platform-browser&#34;:&#34;~13.0.1&#34;,&#34;@angular/platform-browser-dynamic&#34;:&#34;~13.0.1&#34;,&#34;@angular/router&#34;:&#34;~13.0.1&#34;,&#34;@angular/forms&#34;:&#34;~13.0.1&#34;,&#34;@angular/localize&#34;:&#34;~13.0.1&#34;,&#34;@ng-bootstrap/ng-bootstrap&#34;:&#34;11.0.1&#34;,&#34;rxjs&#34;:&#34;~7.4.0&#34;,&#34;typescript&#34;:&#34;~4.4.4&#34;,&#34;zone.js&#34;:&#34;~0.11.4&#34;}">
    
    <input type="hidden" name="project[tags][]" value="angular">
    
    <input type="hidden" name="project[tags][]" value="bootstrap">
    
    <input type="hidden" name="project[tags][]" value="ng-bootstrap">
    
    <input type="hidden" name="project[tags][]" value="datepicker">
    
    
    <input type="hidden" name="project[files][src/polyfills.ts]" value="/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is for so-called &#34;evergreen&#34; browsers; the last versions of browsers that
 * automatically update themselves. This includes Safari &gt;= 10, Chrome &gt;= 55 (including Opera),
 * Edge &gt;= 13 on the desktop, and iOS 10 and Chrome on mobile.
 *
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
 */


/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import &#39;zone.js&#39;;  // Included with Angular CLI.



/***************************************************************************************************
 * APPLICATION IMPORTS
 */
import &#39;@angular/localize/init&#39;;
">
    
    <input type="hidden" name="project[files][tsconfig.json]" value="{
  &#34;compileOnSave&#34;: false,
  &#34;compilerOptions&#34;: {
    &#34;baseUrl&#34;: &#34;./&#34;,
    &#34;outDir&#34;: &#34;./dist/out-tsc&#34;,
    &#34;sourceMap&#34;: true,
    &#34;declaration&#34;: false,
    &#34;downlevelIteration&#34;: true,
    &#34;experimentalDecorators&#34;: true,
    &#34;module&#34;: &#34;esnext&#34;,
    &#34;moduleResolution&#34;: &#34;node&#34;,
    &#34;importHelpers&#34;: true,
    &#34;target&#34;: &#34;es2015&#34;,
    &#34;typeRoots&#34;: [
      &#34;node_modules/@types&#34;
    ],
    &#34;lib&#34;: [
      &#34;es2018&#34;,
      &#34;dom&#34;
    ]
  },
  &#34;angularCompilerOptions&#34;: {
    &#34;enableIvy&#34;: true,
    &#34;fullTemplateTypeCheck&#34;: true,
    &#34;strictTemplates&#34;: true,
    &#34;strictInjectionParameters&#34;: true
  }
}
">
    
    <input type="hidden" name="project[files][angular.json]" value="{
  &#34;version&#34;: 1,
  &#34;newProjectRoot&#34;: &#34;projects&#34;,
  &#34;projects&#34;: {
    &#34;demo&#34;: {
      &#34;root&#34;: &#34;&#34;,
      &#34;sourceRoot&#34;: &#34;src&#34;,
      &#34;projectType&#34;: &#34;application&#34;,
      &#34;prefix&#34;: &#34;app&#34;,
      &#34;schematics&#34;: {},
      &#34;architect&#34;: {
        &#34;build&#34;: {
          &#34;builder&#34;: &#34;@angular-devkit/build-angular:browser&#34;,
          &#34;options&#34;: {
            &#34;outputPath&#34;: &#34;dist/demo&#34;,
            &#34;index&#34;: &#34;src/index.html&#34;,
            &#34;main&#34;: &#34;src/main.ts&#34;,
            &#34;polyfills&#34;: &#34;src/polyfills.ts&#34;,
            &#34;tsConfig&#34;: &#34;tsconfig.json&#34;,
            &#34;assets&#34;: [
            ],
            &#34;styles&#34;: [
            ],
            &#34;scripts&#34;: []
          },
          &#34;configurations&#34;: {
            &#34;production&#34;: {
              &#34;fileReplacements&#34;: [
                {
                }
              ],
              &#34;optimization&#34;: true,
              &#34;outputHashing&#34;: &#34;all&#34;,
              &#34;sourceMap&#34;: false,
              &#34;extractCss&#34;: true,
              &#34;namedChunks&#34;: false,
              &#34;aot&#34;: true,
              &#34;extractLicenses&#34;: true,
              &#34;vendorChunk&#34;: false,
              &#34;buildOptimizer&#34;: true
            }
          }
        },
        &#34;serve&#34;: {
          &#34;builder&#34;: &#34;@angular-devkit/build-angular:dev-server&#34;,
          &#34;options&#34;: {
            &#34;browserTarget&#34;: &#34;demo:build&#34;
          },
          &#34;configurations&#34;: {
            &#34;production&#34;: {
              &#34;browserTarget&#34;: &#34;demo:build:production&#34;
            }
          }
        },
        &#34;extract-i18n&#34;: {
          &#34;builder&#34;: &#34;@angular-devkit/build-angular:extract-i18n&#34;,
          &#34;options&#34;: {
            &#34;browserTarget&#34;: &#34;demo:build&#34;
          }
        },
        &#34;test&#34;: {
          &#34;builder&#34;: &#34;@angular-devkit/build-angular:karma&#34;,
          &#34;options&#34;: {
            &#34;polyfills&#34;: &#34;src/polyfills.ts&#34;,
            &#34;tsConfig&#34;: &#34;tsconfig.json&#34;,
            &#34;styles&#34;: [
            ],
            &#34;scripts&#34;: [],
            &#34;assets&#34;: [
            ]
          }
        },
        &#34;lint&#34;: {
          &#34;builder&#34;: &#34;@angular-devkit/build-angular:tslint&#34;,
          &#34;options&#34;: {
            &#34;tsConfig&#34;: [
              &#34;tsconfig.json&#34;
            ],
            &#34;exclude&#34;: [
              &#34;**/node_modules/**&#34;
            ]
          }
        }
      }
    }
  },
  &#34;defaultProject&#34;: &#34;demo&#34;
}
">
    
    <input type="hidden" name="project[files][src/index.html]" value="&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;head&gt;
  &lt;title&gt;ng-bootstrap datepicker demo - range-popup&lt;/title&gt;
  &lt;link rel=&#34;stylesheet&#34;
    href=&#34;https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css&#34; /&gt;
  &lt;link rel=&#34;stylesheet&#34; href=&#34;https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/themes/prism.css&#34; /&gt;
  &lt;style&gt;
    /* Datepicker popup icon */

button.calendar, button.calendar:active {
  width: 2.75rem;
  background-image: url(&#39;&#39;) !important;
  background-repeat: no-repeat;
  background-size: 23px;
  background-position: center;
}

/* Sortable table demo */

th[sortable] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

th[sortable].desc:before, th[sortable].asc:before {
  content: &#39;&#39;;
  display: block;
  background: url(&#39;&#39;) no-repeat;
  background-size: 22px;
  width: 22px;
  height: 22px;
  float: left;
  margin-left: -22px;
}

th[sortable].desc:before {
  transform: rotate(180deg);
  -ms-transform: rotate(180deg);
}

/* Filtering table demo */
ngbd-table-filtering span.ngb-highlight {
  background-color: yellow;
}

/* Complete table demo */
ngbd-table-complete span.ngb-highlight {
  background-color: yellow;
}

ngb-carousel .picsum-img-wrapper {
  position: relative;
  height: 0;
  padding-top: 55%; /* Keep ratio for 900x500 images */
}

ngb-carousel .picsum-img-wrapper&gt;img {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

  &lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;div class=&#34;container-fluid&#34;&gt;

    &lt;hr&gt;

    &lt;p&gt;
      This is a demo example forked from the &lt;strong&gt;ng-bootstrap&lt;/strong&gt; project: Angular powered Bootstrap.
      Visit &lt;a href=&#34;https://ng-bootstrap.github.io/&#34; target=&#34;_blank&#34;&gt;https://ng-bootstrap.github.io&lt;/a&gt; for more
      widgets and demos.
    &lt;/p&gt;

    &lt;hr&gt;
    &lt;ngbd-datepicker-range-popup&gt;&lt;/ngbd-datepicker-range-popup&gt;
  &lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;
">
    
    <input type="hidden" name="project[files][src/main.ts]" value="import &#39;./polyfills&#39;;

import {platformBrowserDynamic} from &#39;@angular/platform-browser-dynamic&#39;;

import {NgbdDatepickerRangePopupModule} from &#39;./app/datepicker-range-popup.module&#39;;

platformBrowserDynamic()
    .bootstrapModule(NgbdDatepickerRangePopupModule)
    .then(ref =&gt; {
      // Ensure Angular destroys itself on hot reloads.
      if (window[&#39;ngRef&#39;]) {
        window[&#39;ngRef&#39;].destroy();
      }
      window[&#39;ngRef&#39;] = ref;

      // Otherwise, log the boot error
    })
    .catch(err =&gt; console.error(err));
">
    
    <input type="hidden" name="project[files][src/app/datepicker-range-popup.html]" value="&lt;form class=&#34;form-inline&#34;&gt;
  &lt;div class=&#34;form-group hidden&#34;&gt;
    &lt;div class=&#34;input-group&#34;&gt;
      &lt;input name=&#34;datepicker&#34;
             class=&#34;form-control&#34;
             ngbDatepicker
             #datepicker=&#34;ngbDatepicker&#34;
             [autoClose]=&#34;&#39;outside&#39;&#34;
             (dateSelect)=&#34;onDateSelection($event)&#34;
             [displayMonths]=&#34;2&#34;
             [dayTemplate]=&#34;t&#34;
             outsideDays=&#34;hidden&#34;
             [startDate]=&#34;fromDate!&#34;
             tabindex=&#34;-1&#34;&gt;
      &lt;ng-template #t let-date let-focused=&#34;focused&#34;&gt;
        &lt;span class=&#34;custom-day&#34;
              [class.focused]=&#34;focused&#34;
              [class.range]=&#34;isRange(date)&#34;
              [class.faded]=&#34;isHovered(date) || isInside(date)&#34;
              (mouseenter)=&#34;hoveredDate = date&#34;
              (mouseleave)=&#34;hoveredDate = null&#34;&gt;
          {{ date.day }}
        &lt;/span&gt;
      &lt;/ng-template&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&#34;form-group&#34;&gt;
    &lt;div class=&#34;input-group&#34;&gt;
      &lt;input #dpFromDate
             class=&#34;form-control&#34; placeholder=&#34;yyyy-mm-dd&#34;
             name=&#34;dpFromDate&#34;
             [value]=&#34;formatter.format(fromDate)&#34;
             (input)=&#34;fromDate = validateInput(fromDate, dpFromDate.value)&#34;&gt;
      &lt;div class=&#34;input-group-append&#34;&gt;
        &lt;button class=&#34;btn btn-outline-secondary calendar&#34; (click)=&#34;datepicker.toggle()&#34; type=&#34;button&#34;&gt;&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&#34;form-group ml-2&#34;&gt;
    &lt;div class=&#34;input-group&#34;&gt;
      &lt;input #dpToDate
             class=&#34;form-control&#34; placeholder=&#34;yyyy-mm-dd&#34;
             name=&#34;dpToDate&#34;
             [value]=&#34;formatter.format(toDate)&#34;
             (input)=&#34;toDate = validateInput(toDate, dpToDate.value)&#34;&gt;
      &lt;div class=&#34;input-group-append&#34;&gt;
        &lt;button class=&#34;btn btn-outline-secondary calendar&#34; (click)=&#34;datepicker.toggle()&#34; type=&#34;button&#34;&gt;&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/form&gt;

&lt;hr/&gt;
&lt;pre&gt;From date model: {{ fromDate | json }}&lt;/pre&gt;
&lt;pre&gt;To date model: {{ toDate | json }}&lt;/pre&gt;
">
    
    <input type="hidden" name="project[files][src/app/datepicker-range-popup.module.ts]" value="import { NgModule } from &#39;@angular/core&#39;;
import { FormsModule } from &#39;@angular/forms&#39;;
import { BrowserModule } from &#39;@angular/platform-browser&#39;;
import { NgbModule } from &#39;@ng-bootstrap/ng-bootstrap&#39;;

import { NgbdDatepickerRangePopup } from &#39;./datepicker-range-popup&#39;;

@NgModule({
  imports: [BrowserModule, NgbModule, FormsModule],
  declarations: [NgbdDatepickerRangePopup],
  exports: [NgbdDatepickerRangePopup],
  bootstrap: [NgbdDatepickerRangePopup]
})
export class NgbdDatepickerRangePopupModule {}
">
    
    <input type="hidden" name="project[files][src/app/datepicker-range-popup.ts]" value="import {Component} from &#39;@angular/core&#39;;
import {NgbDate, NgbCalendar, NgbDateParserFormatter} from &#39;@ng-bootstrap/ng-bootstrap&#39;;

@Component({
  selector: &#39;ngbd-datepicker-range-popup&#39;,
  templateUrl: &#39;./datepicker-range-popup.html&#39;,
  styles: [`
    .form-group.hidden {
      width: 0;
      margin: 0;
      border: none;
      padding: 0;
    }
    .custom-day {
      text-align: center;
      padding: 0.185rem 0.25rem;
      display: inline-block;
      height: 2rem;
      width: 2rem;
    }
    .custom-day.focused {
      background-color: #e6e6e6;
    }
    .custom-day.range, .custom-day:hover {
      background-color: rgb(2, 117, 216);
      color: white;
    }
    .custom-day.faded {
      background-color: rgba(2, 117, 216, 0.5);
    }
  `]
})
export class NgbdDatepickerRangePopup {

  hoveredDate: NgbDate | null = null;

  fromDate: NgbDate | null;
  toDate: NgbDate | null;

  constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter) {
    this.fromDate = calendar.getToday();
    this.toDate = calendar.getNext(calendar.getToday(), &#39;d&#39;, 10);
  }

  onDateSelection(date: NgbDate) {
    if (!this.fromDate &amp;&amp; !this.toDate) {
      this.fromDate = date;
    } else if (this.fromDate &amp;&amp; !this.toDate &amp;&amp; date &amp;&amp; date.after(this.fromDate)) {
      this.toDate = date;
    } else {
      this.toDate = null;
      this.fromDate = date;
    }
  }

  isHovered(date: NgbDate) {
    return this.fromDate &amp;&amp; !this.toDate &amp;&amp; this.hoveredDate &amp;&amp; date.after(this.fromDate) &amp;&amp; date.before(this.hoveredDate);
  }

  isInside(date: NgbDate) {
    return this.toDate &amp;&amp; date.after(this.fromDate) &amp;&amp; date.before(this.toDate);
  }

  isRange(date: NgbDate) {
    return date.equals(this.fromDate) || (this.toDate &amp;&amp; date.equals(this.toDate)) || this.isInside(date) || this.isHovered(date);
  }

  validateInput(currentValue: NgbDate | null, input: string): NgbDate | null {
    const parsed = this.formatter.parse(input);
    return parsed &amp;&amp; this.calendar.isValid(NgbDate.from(parsed)) ? NgbDate.from(parsed) : currentValue;
  }
}
">
    
  </form>
  <script>document.getElementById("mainForm").submit();</script>
</body>

</html>
